<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get the column names in result</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.cubrid-column-names" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_column_names</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.3.0)</p><p class="refpurpose"><span class="refname">cubrid_column_names</span> &mdash; <span class="dc-title">Get the column names in result</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-column-names-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>cubrid_column_names</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$req_identifier</code></span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
    The <span class="function"><strong>cubrid_column_names()</strong></span> function is used to get the
    column names of the query result by using <code class="parameter">req_identifier</code>.
  </p>
 </div>

 
  <div class="refsect1 parameters" id="refsect1-function.cubrid-column-names-parameters">
 <h3 class="title">参数</h3>
 <p class="para">
  <dl>

    
  <dt>
<code class="parameter">req_identifier</code></dt>

  <dd>
<p class="para">Request identifier.</p></dd>

   
  </dl>

  </p>
 </div>


  <div class="refsect1 returnvalues" id="refsect1-function.cubrid-column-names-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    Array of string values containing the column names, when process is successful. 
  </p>
    <p class="para">
    <strong><code>FALSE</code></strong>, when process is unsuccessful.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.cubrid-column-names-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1095">
   <p><strong>Example #1 <span class="function"><strong>cubrid_column_names()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"dba"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"SELECT&nbsp;*&nbsp;FROM&nbsp;game&nbsp;WHERE&nbsp;host_year=2004&nbsp;AND&nbsp;nation_code='AUS'&nbsp;AND&nbsp;medal='G'"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$column_names&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_column_names</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$column_types&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_column_types</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%-30s&nbsp;%-15s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Column&nbsp;Names"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Column&nbsp;Types"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Column&nbsp;Maxlen"</span><span style="color: #007700">);<br />for(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$size&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$column_names</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$size</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$column_len&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_field_len</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%-30s&nbsp;%-15s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$column_names</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">$column_types</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">$column_len</span><span style="color: #007700">);&nbsp;<br />}<br /><br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Column Names                   Column Types                   Column Maxlen  
host_year                      integer                        11             
event_code                     integer                        11             
athlete_code                   integer                        11             
stadium_code                   integer                        11             
nation_code                    char                           3              
medal                          char                           1              
game_date                      date                           10             
</pre></div>
   </div>
  </div>
 </div>


   <div class="refsect1 seealso" id="refsect1-function.cubrid-column-names-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="cubrid_prepare.html" class="function" rel="rdfs-seeAlso">cubrid_prepare()</a> - Prepare a SQL statement for execution</span></li>
    <li class="member"><span class="function"><a href="cubrid_execute.html" class="function" rel="rdfs-seeAlso">cubrid_execute()</a> - Execute a prepared SQL statement</span></li>
    <li class="member"><span class="function"><a href="cubrid_column_types.html" class="function" rel="rdfs-seeAlso">cubrid_column_types()</a> - Get column types in result</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>